<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>

    </style>
</head>
<body>

    <div id="box">


    </div>

    
    <script src="./js/react.js"></script>
    <script src="./js/react-dom.js"></script>
    <script src="./js/babel.min.js"></script>

    <script type="text/babel">
        
        const person = {
            name:"王义鑫",
            age:12
        }

        if(person.age>=18){
            var jsx = <p>已成年</p>
        }else{
            var jsx = <p>未成年</p>
        }

        function isAllowMarry(){
            if(person.age>=22){
                return <p style={{"backgroundColor":"green"}}>可以结婚</p>
            }else{
                return <p style={{"backgroundColor":"red"}}>千万不能结婚</p>
            }
        }
   
        const book = (<div>
             <h1>人的信息：</h1>
             <p>姓名：{person.name}</p>
             {jsx}
             {isAllowMarry()}
            </div>
        );
        
        ReactDOM.render(book,document.getElementById("box"));

        
    </script>
</body>
</html>
